package org.czp.main;

import org.eclipse.jetty.server.Connector;
import org.eclipse.jetty.server.Server;
import org.eclipse.jetty.server.handler.ContextHandler;
import org.eclipse.jetty.server.nio.SelectChannelConnector;
import org.eclipse.jetty.util.resource.Resource;

public class Bootstart {
	public static void main(String[] args) throws Exception {
		Server service = new Server();
		Connector connector = new SelectChannelConnector();
		connector.setPort(8080);
		connector.setHost("127.0.0.1");
		service.setConnectors(new Connector[] { connector });
		// 设置根路径
		ContextHandler context = new ContextHandler("/zk-web");
		Resource base = Resource.newResource("G:/git/zk-web/src/main/webapp/");
		context.setBaseResource(base );
		service.setHandler(context);
		service.setStopAtShutdown(true);
		service.setSendServerVersion(true);
		// 启动服务
		service.start();
		service.join();
	}
}